﻿@model IList<HZU.ZP.Domain.Model.Position>
@{
    Layout = "_AdminLayout";
}
<script>
    $(document).ready(function () {
        $(".eee").mouseover(function () {
            $(this).css({ "background-color": "gainsboro" });
        }).mouseout(function () {
            $(this).css({ "background-color": "" });
        });
        $("button#upDate").click(function () {
            $.ajax({
            type: 'post',
                url: '/Position/UpdateAdmin',
                data: 'id=' + $(this).data("id") + '&status=' + $(this).data("status"),
            success: function (message) {
                if (message.returnCode == "001") {
                    alert("保存成功");
                    location.reload();
                } else if (message.returnCode == "4070") {
                    alert("职位不存在！");
                }
            }
        });
        });
        $("button#delete").click(function () {
            if (confirm("确实要删除吗？")) {
                $.ajax({
                    type: 'post',
                    url: '/Position/Delete',
                    data: 'id=' + $(this).data("id"),
                    success: function (message) {
                        if (message.returnCode == "001") {
                            alert("删除成功！");
                            location.reload();
                        } else if (message.returnCode == "4070") {
                            alert("职位不存在！");
                        }
                    }
                });
            }
            else {
            }
        });
    });
</script>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="row clearfix">
                <div class="col-md-2 column">
                    <span>职位名</span>
                </div>
                <div class="col-md-4 column">
                    <span>企业名称</span>
                </div>
                <div class="col-md-2 column">
                    <span>资薪</span>
                </div>
                <div class="col-md-2 column">
                    <span>发布时间</span>
                </div>
                <div class="col-md-2 column">
                    <span>操作</span>
                </div>
            </div>
            @if (Model.Count() > 0)
            {
                foreach (var pos in Model)
                {
                    <div class="eee">
                        <div class="row clearfix">
                            <div class="col-md-2 column">
                                <a href="/Position/GetPositionAndCompanyInfoAdmin?id=@pos.Id" style="font-size:large;color:red">@pos.Name</a>
                            </div>
                            <div class="col-md-4 column">
                                @pos.CompanyName
                            </div>
                            <div class="col-md-2 column">
                                @pos.Salary
                            </div>
                            <div class="col-md-2 column">
                                @pos.CreateTime.ToString("yyyy-MM-dd")
                            </div>
                            <div class="col-md-2 column">
                                <button id="upDate" type="button" class="btn btn-default btn-link" data-id="@pos.Id" data-status="3">暂停</button>
                                &thinsp;
                                <button id="delete" type="button" class="btn btn-default btn-link" data-id="@pos.Id">删除</button>
                            </div>
                        </div>
                    </div>
                }
            }
            else
            {
                <h4 style="height:300px;text-align:center">无数据。。。</h4>
            }
        </div>
    </div>
</div>